<div id="comments">
    <? echo $adminMenu->manage(); ?>
    <h2><?php __('Comments administration');?></h2>
    <? echo $html->link(__('Delete all spam',true),array('action'=>'Delete_spam')); ?>
    <? echo $form->create(array('action'=>'Delete_comments')); ?>
    <table cellpadding="3" cellspacing="1" width="100%">
        <tr>
            <td width="7%"></td>
            <td></td>
            <td width="10%"></td>
            <td width="10%"></td>
            <td width="10%"></td>
            <td width="10%"></td>
        </tr>
        <tr class="table_head">
            <td colspan="2" class="first-top">
                <? echo $pagination->create(null,'comments'); ?>
            </td>
            <td colspan="5" class="last-top">
                <? __('Sort by'); ?>: <?php echo $paginator->sort(__('Username',true),'user_name');?> <? echo $paginator->sort(__('Spam',true),'antispam'); ?> <?php echo $paginator->sort(__('IP address',true),'user_IP address');?>
            </td>
        </tr>
        <tr>
            <th><? __('Action'); ?></th>
            <th><? __('Title'); ?></th>
            <th><? __('Username'); ?></th>
            <th><? __('IP address'); ?></th>
            <th><? __('Spam'); ?></th>
            <th><? __('Delete'); ?> <input type="checkbox" onclick="checkAll(this,'CommentDeleteCommentsForm')"/></th>
        </tr>
        <?php
        $i = 0;
        foreach ($comments as $comment):
            $class = null;
            if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
            }
            ?>
        <tr<?php echo $class;?>>
            <td>
                    <? echo $html->link($html->image('Edit.png',array('alt'=>__('Edit', true))),array('action'=>'edit', $comment['Comment']['id']),array('title'=>__('Edit',true)),null,false); ?>
                    <? echo $html->link($html->image('eye.png',array('alt'=>__("Preview",true))),"/articles/".$time->format("Y/m/d",$comment["Article"]["created"])."/".$comment["Article"]["seo_link"].'/#comment_'.$comment['Comment']['id'],array('title'=>__('Preview',true),"target"=>"new"),null,false); ?>
                    <? echo $html->link($html->image('bin.png',array('alt'=>__('Delete', true))), array('action'=>'delete', $comment['Comment']['id']),array('title'=>__('Delete',true)), __('Delete item', true).' #' . $comment['Comment']['title'],false); ?>
            </td>
            <td>
                    <? echo $html->link($comment['Comment']['title'], array('action'=>'edit', $comment['Comment']['id'])); ?>
            </td>
            <td>
                    <?php echo $comment['Comment']['user_name']?>
            </td>
            <td>
                    <?php echo $comment['Comment']['user_ip']?>
            </td>
            <td>
                    <?php echo ($comment['Comment']['antispam']!=null) ? __('yes') : __('no')?>
            </td>
            <td  align="center">
                <input type="checkbox" name="data[CommentsDelete][]" value="<? echo $comment['Comment']['id']; ?>"/>
            </td>
        </tr>
        <?php endforeach; ?>
        <tr class="table_head">
            <td colspan="2" class="first-bottom">
                <? echo $pagination->create(null,'comments'); ?>
            </td>
            <td colspan="4" class="last-bottom">
                <? __('Sort by'); ?>: <?php echo $paginator->sort(__('Username',true),'user_name');?> <? echo $paginator->sort(__('Spam',true),'antispam'); ?> <?php echo $paginator->sort(__('IP address',true),'user_IP address');?>
            </td>
        </tr>
    </table>
    <div style="float: right; margin: 1em;"><? echo $form->submit(__('Delete',true)); ?></div>
</form>
</div>